#ifndef GAMEHANDLER_H_INCLUDED
#define GAMEHANDLER_H_INCLUDED


#include <vector> 
#include "TextureManager.h"
#include "RendererPtr.h"
#include "WindowPtr.h"


class GameObject; 


class GameHandler
{
public: 
	static GameHandler* Instance()
	{
		if (s_pInstance == nullptr)
		{
			s_pInstance = new GameHandler(); 
			return s_pInstance; 
		}

		return s_pInstance; 
	}

	bool Init(std::string = "", int = SDL_WINDOWPOS_CENTERED, int = SDL_WINDOWPOS_CENTERED, int = 640, int = 480, int = SDL_WINDOW_SHOWN);  
	void Render(); 
	void Update(); 
	void handleEvents(); 
	void CleanUp(); 
	bool isRunning() const { return m_bRunning; } 
	void Quit() { m_bRunning = false; } 

	SDL_Renderer* getRenderer() const { return m_renderer.m_pRenderer; } 

private: 
	static GameHandler* s_pInstance; 
	
	bool     m_bRunning; 
	Window   m_window; 
	Renderer m_renderer;
	
	std::vector <GameObject*>  m_gameObjects;  
	
	GameHandler() {};
	~GameHandler() {}; 
	GameHandler(const GameHandler&); 
	GameHandler& operator=(const GameHandler&); 
}; 
	

#endif // GAMEHANDLER_H_INCLUDED